package com.kksoft.readcm.a;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Environment;
import android.os.StatFs;
import com.kksoft.readcm.activity.App;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.b.a.b.b;

public final class c extends AppObservable
{
  private String k="";
  private String l="";
  private String m="";
  private String n="";
  private String o="";
  private String p="";
  private String q="";
  private String r="";
  private String s="";
  private String t="";
  private String u="";
  private String v="";
  private  boolean w=false;
  //private final boolean w=false;

  public  c()
  {
   // if (App.h().getBoolean("firstLoad", 1))
    {
      String str1 = Environment.getExternalStorageState();
      //if (!"mounted".equals(str1))
        //break label811;
      String str2 = Environment.getDataDirectory().getPath();
      StatFs localStatFs1 = new StatFs(str2);
      long l1 = localStatFs1.getAvailableBlocks();
      long l2 = localStatFs1.getBlockSize() * l1;
      if (l2 >= 78643200L);
    }
    //label128: label811: 
    	int i1;
    for (int i = 1; ; i1 = 0)
      while (true)
      {
        SharedPreferences.Editor localEditor1 = App.getSharedPreferences().edit();
        //if (i == 0)
         // SharedPreferences.Editor localEditor2 = localEditor1.putBoolean("useSdCard", 0);
       // SharedPreferences.Editor localEditor3 = localEditor1.putBoolean("firstLoad", 0);
        boolean bool2 = localEditor1.commit();
       // this.w = i;
        String str3 = File.separator;
        this.k = str3;
        String str4 = App.getAppThis().getFilesDir().getAbsolutePath();
        this.v = str4;
        String str5 = String.valueOf(this.v);
        StringBuilder localStringBuilder1 = new StringBuilder(str5);
        String str6 = this.k;
        String str7 = str6 + "RIL_offline";
        this.t = str7;
        String str8 = String.valueOf(Environment.getExternalStorageDirectory().toString());
        StringBuilder localStringBuilder2 = new StringBuilder(str8).append("/Android/data/");
        String str9 = App.getAppThis().getPackageName();
        String str10 = str9 + "/files";
        this.u = str10;
        String str11 = String.valueOf(this.u);
        StringBuilder localStringBuilder3 = new StringBuilder(str11);
        String str12 = this.k;
        String str13 = str12 + "RIL_offline";
        this.s = str13;
        if (this.w)
        {
          String str14 = this.u;
          this.l = str14;
          String str15 = this.s;
          this.m = str15;
          String str16 = String.valueOf(this.l);
          StringBuilder localStringBuilder4 = new StringBuilder(str16);
          String str17 = this.k;
          String str18 = str17 + "RIL_clean_up";
          this.n = str18;
          String str19 = String.valueOf(this.m);
          StringBuilder localStringBuilder5 = new StringBuilder(str19);
          String str20 = this.k;
          String str21 = str20 + "RIL_pages";
          this.o = str21;
          String str22 = String.valueOf(this.m);
          StringBuilder localStringBuilder6 = new StringBuilder(str22);
          String str23 = this.k;
          String str24 = str23 + "RIL_assets";
          this.p = str24;
          String str25 = String.valueOf(this.l);
          StringBuilder localStringBuilder7 = new StringBuilder(str25);
          String str26 = this.k;
          String str27 = str26 + "RIL_temp";
          this.q = str27;
          String str28 = String.valueOf(this.m);
          StringBuilder localStringBuilder8 = new StringBuilder(str28);
          String str29 = this.k;
          String str30 = str29 + "RIL_favicons";
          this.r = str30;
          //if ((this.w) && (!App.h().getBoolean("sdCardSetup", 0)))
          {
            String str31 = this.m;
            boolean bool3 = new File(str31).mkdirs();
          }
        }
        String str32 = this.l;
          File localFile = new File(str32, ".nomedia");
          String str33 = this.l;
          //if ((new File(str33, ".nomedia").createNewFile()) || (localFile.exists()))
           // boolean bool4 = App.h().edit().putBoolean("sdCardSetup", 1).commit();
          return;
          //String str34 = Environment.getExternalStorageDirectory().getAbsolutePath();
          //StatFs localStatFs2 = new StatFs(str34);
          //long l3 = localStatFs2.getAvailableBlocks();
          //if (localStatFs2.getBlockSize() * l3 > localFile)
         // {
           // int j = 1;
           // continue;
           // boolean bool1 = App.h().getBoolean("useSdCard", 1);
          //  break label128;
          //  String str35 = this.v;
          //  this.l = str35;
          //  String str36 = this.t;
         //   this.m = str36;
         // }
      }
  }

  private static void a(File paramFile)
  {
    try
    {
      //b.a(paramFile);
      label4: return;
    }
    //catch (IOException localIOException)
    //{
      //while (true)
        //App.b(localIOException);
    //}
    catch (Throwable localThrowable)
    {
      while (true)
        App.b(localThrowable);
    }
    //catch (FileNotFoundException localFileNotFoundException)
    //{
      //break label4;
    //}
  }

  private static void a(String paramString, boolean paramBoolean)
  {
    File[] arrayOfFile = new File(paramString).listFiles();
    int i;
    if (arrayOfFile != null)
      i = 0;
    while (true)
    {
      int j = arrayOfFile.length;
      //if (i >= j)
        //return;
      //String str = arrayOfFile[i].getAbsolutePath();
      //if ((arrayOfFile[i].isDirectory()) && ((paramBoolean) || (str.indexOf("RIL_clean_up") != -1)))
        //a(arrayOfFile[i]);
      //i += 1;
    }
  }

  private String c(int paramInt)
  {
    String str1 = String.valueOf(this.o);
    StringBuilder localStringBuilder1 = new StringBuilder(str1);
    String str2 = this.k;
    StringBuilder localStringBuilder2 = localStringBuilder1.append(str2);
    String str3 = String.valueOf(paramInt);
    return str3;
  }

  public static String c(String paramString)
  {
    return "file://" + paramString;
  }

  public static String e(String paramString)
  {
    return paramString.replaceAll("[\\#\\=\\?\\&\\%\\;\\:\\*\\\"\\<\\>\\|]", "");
  }

  public final String a()
  {
    return this.m;
  }

  public final String a(int paramInt)
  {
    StringBuilder localStringBuilder = new StringBuilder("file://");
    Integer localInteger = Integer.valueOf(paramInt);
    String str = a(localInteger);
    return str;
  }

  public final String a(int paramInt, String paramString)
  {
    String str1 = String.valueOf(c(paramInt));
    StringBuilder localStringBuilder1 = new StringBuilder(str1);
    String str2 = this.k;
    StringBuilder localStringBuilder2 = localStringBuilder1.append(str2).append("web");
    //if ((paramString != null) && (paramString.length() > 0))
      boolean bool = paramString.toLowerCase().startsWith("text/");
    return ".html";
  }

  public final String a(Integer paramInteger)
  {
    int i = paramInteger.intValue();
    String str1 = String.valueOf(c(i));
    StringBuilder localStringBuilder = new StringBuilder(str1);
    String str2 = this.k;
    return str2 + "text.html";
  }

  public final String a(String paramString)
  {
    String str1 = String.valueOf(this.q);
    StringBuilder localStringBuilder1 = new StringBuilder(str1);
    String str2 = this.k;
    StringBuilder localStringBuilder2 = localStringBuilder1.append(str2);
    String str3 = e(paramString);
    String str4 = str3;
    return new File(str4).toString();
  }

  public final String b()
  {
    return this.p;
  }

  public final String b(int paramInt, String paramString)
  {
    StringBuilder localStringBuilder = new StringBuilder("file://");
    String str = a(paramInt, paramString);
    return str;
  }

  public final String b(String paramString)
  {
    String str1 = String.valueOf(this.r);
    StringBuilder localStringBuilder1 = new StringBuilder(str1);
    String str2 = this.k;
    StringBuilder localStringBuilder2 = localStringBuilder1.append(str2).append(paramString);
    String str3 = this.k;
    return str3 + "favicon.ico";
  }

  public final void b(int paramInt)
  {
    String str = c(paramInt);
    if ((str != null) && (str.length() > 0))
      a(new File(str));
  }

  public final void c()
  {
    int i = App.getSharedPreferences().getInt("path_inc", 1) + 1;
    if (i > 9000)
      i = 0;
    boolean bool1 = App.getSharedPreferences().edit().putInt("path_inc", i).commit();
    String str1 = this.m;
    File localFile1 = new File(str1);
    String str2 = String.valueOf(this.n);
    StringBuilder localStringBuilder = new StringBuilder(str2);
    String str3 = String.valueOf(i);
    String str4 = str3;
    File localFile2 = new File(str4);
    boolean bool2 = localFile1.renameTo(localFile2);
  }

  public final void d()
  {
//    String str1 = Environment.getExternalStorageState();
//    String str2;
//    if ("mounted".equals(str1))
//    {
//      str2 = this.u;
//      if (!this.w)
//        break label71;
//    }
//    label71: int j;
//    for (int i = 0; ; j = 1)
//    {
//      a(str2, i);
//      String str3 = this.v;
//      boolean bool = this.w;
//      a(str3, bool);
//      String str4 = this.q;
//      a(new File(str4));
//      return;
//    }
  }

  public final void d(String paramString)
  {
    String str1 = String.valueOf(this.p);
    StringBuilder localStringBuilder = new StringBuilder(str1);
    String str2 = this.k;
    String str3 = str2 + paramString;
    a(new File(str3));
  }

  public final boolean e()
  {
    return this.w;
  }

  public final int f()
  {
    String str1 = Environment.getExternalStorageState();
    int i;
    if ("mounted".equals(str1))
    {
      String str2 = this.m;
      if (new File(str2).exists())
        i = 1;
    }
//    while (true)
//    {
//      return i;
//      i = 3;
//      continue;
//      i = 2;
//    }
	return 0;
  }

  public final String g()
  {
    if (this.w);
    for (String str = App.getAppString(2131165195); ; str = App.getAppString(2131165196))
      return str;
  }

  public final boolean h()
  {
//    if (!this.w)
//    {
//      File localFile1 = Environment.getDataDirectory();
//      String str = localFile1.getPath();
//      StatFs localStatFs = new StatFs(str);
//      long l1 = localStatFs.getAvailableBlocks();
//      if (localStatFs.getBlockSize() * l1 > 2097152L)
//        break label58;
//    }
//    label58: int j;
//    for (int i = 1; ; j = 0)
//    {
//      return i;
//      File localFile2 = Environment.getExternalStorageDirectory();
//      break;
//    }
	return false;
  }

  public final void i()
  {
    super.i();
    c();
  }
}

/* Location:           E:\AndroidDecompiler\jd-gui-0.3.3.windows\newrclasses.dex.dex2jar.jar
 * Qualified Name:     com.kksoft.readcm.a.c
 * JD-Core Version:    0.6.0
 */